package com.book.helper;

import com.book.dto.ShopCarDto;
import com.book.pojo.ShopCar;
import org.springframework.beans.BeanUtils;

import java.beans.beancontext.BeanContext;

/**
 * @Author 李锦程
 * @Date 2021/4/2 3:06 下午
 * @Package com.book.helper
 * @Version 1.0
 */
public class ShopCarHelper {
    public static ShopCarDto convertPoDto(ShopCar shopCar){
        if (shopCar==null){
            return null;
        }
        else {
            ShopCarDto shopCarDto = new ShopCarDto();
            BeanUtils.copyProperties(shopCar,shopCarDto);
            return shopCarDto;
        }
    }

    public static ShopCar covertDtoPo(ShopCarDto car) {
        if (car==null){
            return null;
        }
        else {
            ShopCar shopCar = new ShopCar();
            BeanUtils.copyProperties(car,shopCar);
            return shopCar;
        }
    }
}
